<template>
  <div id="app">
    <router-view />
  </div>
</template>

<script>
export default {
  name: "App",
  watch: {
    $route() {
      this.$nextTick(() => {
        let currentItem = document.querySelector(".el-submenu.is-active");
        let wrapper = document.querySelector(
          ".scrollbar-wrapper.el-scrollbar__wrap"
        );
        wrapper &&
          wrapper.scrollTo({
            top: currentItem && currentItem.offsetTop - 50,
            behavior: "smooth"
          });
      });
    }
  }
};
</script>
